Object.defineProperty(exports, "__esModule", {
    value: !0
}), exports.gochat = exports.handleVisitorLists = void 0;

var _util2 = _interopRequireDefault(require("../../../../utils/util")), _radarUtil = require("../../../../utils/radar-util"), _util3 = _interopRequireDefault(require("../../../../public/utils/util"));

function _interopRequireDefault(t) {
    return t && t.__esModule ? t : {
        default: t
    };
}

var tagReg = /<span style='(.+?)'>(.+?)<\/span>/gim, VERSION_LOG_TYPE = 21, CARD_LOG_TYPE = 22, handleVisitorLists = function(t) {
    return t.map(function(t) {
        t.formatDate = _util3.default.formatTimeStamp(1e3 * t.createtime);
        var e = t.content, a = e.type, r = e.content;
        return [ VERSION_LOG_TYPE, CARD_LOG_TYPE ].includes(a) || (r = r.split(/\s(.*)/)[1]), 
        t.contents = _util2.default.regExpSeparateLabels(r, tagReg), t.realname = t.desc || t.realname, 
        t;
    });
};

exports.handleVisitorLists = handleVisitorLists;

var gochat = function(t, a) {
    var e = t.currentTarget.dataset, r = e.name, i = e.uid, n = e.type, u = new Map([ [ VERSION_LOG_TYPE, function() {
        return wx.navigateTo({
            url: "/pages/mine/log/log"
        });
    } ], [ CARD_LOG_TYPE, function() {
        "card" !== a.data.mode && getCurrentPages().slice(-1)[0].setData({
            cardShown: !0
        });
    } ], [ "chat", function() {
        var t = a.data.card, e = t ? t.cardid : "";
        (0, _radarUtil.gotoChatRoom)({
            name: r,
            cardid: e,
            touid: i
        });
    } ] ]);
    (u.get(+n) || u.get("chat")).call(a);
};

exports.gochat = gochat;